import { Form } from "@/components/layout/form/form";
import { IMAGES, SELECT, TEXT, CHECKBOX, TEXTAREA } from "@/utils/enums/type-enums";
import Storage from "@/utils/storage";
import { ACCESS_TOKEN_KEY } from "@/utils/enums/cache-enum";
export const productAddForms: Form[] = [
  {
    label: null,
    card: [
      {
        type: IMAGES,
        label: '上传产品图片',
        name: 'imageUrl',
        span: 24,
        action: '/bms/upload/file',
        headers: {
          token: Storage.get(ACCESS_TOKEN_KEY)
        }
      },
      { line: true },
      { type: TEXT, label: '产品名称', name: 'specName', span: 6, placeholder: '请输入产品名称' },
      { type: TEXT, label: '产品编号', name: 'specCode', span: 6, placeholder: '请输入规格编号' },
      { type: TEXT, label: '产品型号', name: 'specModel', span: 6, placeholder: '请输入产品型号' },
      { line: true },
      { type: SELECT, label: '设备类型', name: 'deviceType', span: 6, options: [] },
      { type: SELECT, label: '产品版本', name: 'specVersion', span: 6, options: [] },
      { line: true },
      {
        type: SELECT, label: '通道类型', name: 'channelType', span: 6, options: [
          { label: '单通道', value: "0" },
          { label: '多通道', value: "1" },
        ]
      },
      {
        type: SELECT, label: '配网方式', name: 'distributionType', span: 6, options: [
          { label: 'WIFI连接', value: "0" },
          { label: '不需要配网', value: "1" },
          { label: 'WIFI广播', value: "2" },
          { label: '蓝牙配网', value: "3" },
        ]
      },
      { type: SELECT, label: '规格', name: 'typeCode', span: 6, options: [] },
      { line: true },
      {
        type: SELECT, label: '是否支持外设', name: 'peripheral', span: 6, options: [
          { label: '否', value: 0 },
          { label: '是', value: 1 },
        ]
      },
      {
        type: SELECT, label: '是否在线升级', name: 'upgrade', span: 6, options: [
          { label: '否', value: 0 },
          { label: '是', value: 1 },
        ]
      },
      { line: true },
      { type: TEXT, label: '尺寸(cm)长', name: 'longs', span: 6, placeholder: '请输入尺寸(cm)长' },
      { type: TEXT, label: '尺寸(cm)宽', name: 'wide', span: 6, placeholder: '请输入尺寸(cm)宽' },
      { type: TEXT, label: '尺寸(cm)高', name: 'high', span: 6, placeholder: '请输入尺寸(cm)高' },
      { line: true },
      { type: CHECKBOX, label: '支持监测信息', name: 'functionList', span: 12, options: [] },
      { line: true },
      {
        type: SELECT, label: '接入类型', name: 'accessType', span: 6, options: [
          { label: '设备直连', value: '0' },
          { label: 'APE-IOT', value: '1' },
          { label: '三方服务器', value: '2' },
        ]
      },
      {
        type: SELECT, label: '网络类型', name: 'networkType', span: 6, options: [
          { label: 'WIFI', value: '0' },
          { label: '4G', value: '1' },
          { label: 'NB网络', value: '2' },
          { label: '有线链接', value: '3' },
        ]
      },
      { line: true },
      { type: SELECT, label: '供应商', name: 'supplierList', span: 6, options: [] },
      { line: true },
      { type: TEXT, label: '联系地址', name: 'address', span: 6, placeholder: '请输入联系地址', disabled: true },
      { type: TEXT, label: '联系人', name: 'contacts', span: 6, placeholder: '请输入联系人', disabled: true },
      { type: TEXT, label: '联系电话', name: 'telephone', span: 6, placeholder: '请输入联系电话', disabled: true },
      { line: true },
      { type: TEXTAREA, label: '备注', name: 'remark', span: 16, style: 'width: 400px', placeholder: '请输入备注' },
    ]
  }
]

export const productAddRules = {
  specName: [{ required: true, message: '产品名称不能为空', trigger: 'blur' }],
  specCode: [{ required: true, message: '请输入产品编号', trigger: 'blur' }],
  deviceType: [{ required: true, message: '请选择设备类型', trigger: 'blur' }],
  // specVersion: [{ required: true, message: '请选择产品版本', trigger: 'blur' }],
  specModel: [{ required: true, message: '请输入产品型号', trigger: 'blur' }],
  channelType: [{ required: true, message: '请选择通道类型', trigger: 'blur' }],
  peripheral: [{ required: true, message: '请选择是否支持连接外设', trigger: 'blur' }],
  distributionType: [{ required: true, message: '请选择配网方式', trigger: 'blur' }],
  upgrade: [{ required: true, message: '请选择是否支持在线升级', trigger: 'blur' }],
  // typeCode: [{ required: true, message: '请选择规格', trigger: 'blur' }],
  longs: [{ required: true, message: '请输入尺寸(cm)长', trigger: 'blur' }],
  wide: [{ required: true, message: '请输入尺寸(cm)宽', trigger: 'blur' }],
  high: [{ required: true, message: '请输入尺寸(cm)高', trigger: 'blur' }],
  functionList: [{ required: true, message: '请选择支持监测信息', trigger: 'blur' }],
  accessType: [{ required: true, message: '请选择接入类型', trigger: 'blur' }],
  networkType: [{ required: true, message: '请选择网络类型', trigger: 'blur' }],
  supplierList: [{ required: true, message: '请选择供应商', trigger: 'blur' }],
}